<%--
  Created by IntelliJ IDEA.
  User: qiliping
  Date: 15/12/2
  Time: 上午11:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>${title}</title>
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            ${subtitle} <small>${title}</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li><i class="fa fa-home"></i> <a href="${ctx}"> 首页 </a> <i
                    class="fa fa-angle-right"></i></li>
            <li>
                <a href="${ctx}/adviser?type=${AdviserAddModel.type}"> ${subtitle} </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li><a href="#"> ${title} </a></li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<!-- END PAGE HEADER-->
<!------内容区---->
<div class="main">

    <div class="row">
        <div class="col-md-12">
            <form:form modelAttribute="AdviserAddModel" method="post"
                       class="form-horizontal">
                <form:hidden path="adviserId"></form:hidden>
                <form:hidden path="type"></form:hidden>
                <%--<div class="form-group">
                    <label class="control-label col-md-3">类型：</label>
                    <div class="col-md-4">
                        <form:select path="type" class="form-control">
                            <form:option value="0">合作投顾</form:option>
                            <form:option value="1">投研专家</form:option>
                        </form:select>

                    </div>
                </div>--%>
                <div class="form-group">
                    <label class="control-label col-md-3">姓名：</label>
                    <div class="col-md-4">
                        <form:input path="adviserName" cssClass="form-control" placeholder=""></form:input>
                    </div>
                    <form:errors path="adviserName" cssClass="field-validation-error" element="div"></form:errors>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">头像：</label>
                    <div class="col-md-4">
                        <div class="input-group">
                            <img alt="" id="aimg" src="${AdviserAddModel.adviserPic}" width="100px" height="100px" />
                            <form:hidden path="adviserPic" id="product_pic"/>
                            <input id="image3" type="button" value="上传图片" />
                        </div>
                        <form:errors path="adviserPic"></form:errors>
                    </div>

                </div>
                <c:if test="${type==0}">
                <div class="form-group">
                    <label class="control-label col-md-3">从业经验：</label>
                    <div class="col-md-2">
                        <div class="input-group">
                            <form:input path="experience" cssClass="form-control" maxlength="2" placeholder=""></form:input>
                            <span class="input-group-addon">(年)</span>
                        </div>
                    </div>
                    <form:errors path="experience"></form:errors>
                </div>
                </c:if>
                <div class="form-group">
                    <label class="control-label col-md-3">推荐星级：</label>
                    <div class="col-md-2">
                        <div class="input-group">
                            <form:input path="adviserLevel" cssClass="form-control" maxlength="1" placeholder=""></form:input>
                            <span class="input-group-addon">星</span>
                        </div>
                        <form:errors path="adviserLevel"></form:errors>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">所在机构：</label>
                    <div class="col-md-4">
                        <form:input path="organization" cssClass="form-control" placeholder=""></form:input>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">
                        <c:choose>
                            <c:when test="${type==0}">
                                投资策略：
                            </c:when>
                            <c:when test="${type==1}">
                                研究领域：
                            </c:when>
                        </c:choose>
                    </label>
                    <div class="col-md-4">
                        <form:input path="investmentStrategy" cssClass="form-control" placeholder=""></form:input>

                    </div>
                </div>
                <c:if test="${type==0}">
                <div class="form-group">
                    <label class="control-label col-md-3">代表作品：</label>
                    <div class="col-md-4">
                        <form:input path="behalf" cssClass="form-control" placeholder=""></form:input>
                    </div>
                </div>
                </c:if>
                <div class="form-group">
                    <label class="control-label col-md-3">介绍：</label>
                    <div class="col-md-8">

                        <form:textarea path="adviserIntro" style="width: 100%; height: 400px;" cssClass="form-control"></form:textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">是否推荐：</label>
                    <div class="col-md-4">
                        <div class="radio-list">
                            <label class="radio-inline">
                                <form:radiobutton path="isRecommend" value="0"></form:radiobutton>否
                            </label>
                            <label class="radio-inline">
                                <form:radiobutton path="isRecommend" value="1"></form:radiobutton>是
                            </label>

                        </div>

                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <button type="submit" class="btn blue">保存</button>
                        <span class="field-validation-error">${error}</span>
                    </div>
                </div>
            </form:form>
        </div>
    </div>

</div>
<myfooter> <script>
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('textarea[name="adviserIntro"]', {
            allowFileManager : true
        });

        var uploadbutton = K.uploadbutton({
            button : K('#image3')[0],
            fieldName : 'imgFile',
            url : '${ctx}/file_upload?dir=image',
            afterUpload : function(data) {
                if (data.error === 0) {
                    var url = K.formatUrl(data.url, 'absolute');
                    aimg
                    K('#aimg').attr("src", url);
                    K('#product_pic').val(url);
                } else {
                    alert(data.message);
                }
            },
            afterError : function(str) {
                alert('自定义错误信息: ' + str);
            }
        });
        uploadbutton.fileBox.change(function(e) {
            uploadbutton.submit();
        });
    });
</script> </myfooter>
</body>
</html>